var co = require('co');
var OSS = require('ali-oss');
var util=require("util");
var config   = require('../config'); //获取配置文件信息

const options = {
    region: config.region,
    accessKeyId:config.accessKeyId,
    accessKeySecret:config.accessKeySecret ,
    bucket:config.bucket
};
var client = new OSS(options);

//上传文件到OSS
exports.uploadOSS = function(path,filepath,callback){
    co(function*() {
        var result = yield client.put(path,filepath);
        callback(result)
    }).catch(function (err) {
        callback(err)
    });
};

